//---------------------------------------------------------------------------

#ifndef MultiFtpDownloadThreadH
#define MultiFtpDownloadThreadH
//---------------------------------------------------------------------------
#ifndef Winsock2H
#include <Winsock2.h>
#pragma comment(lib,"WS2_32.lib")
#endif
#ifndef MultiThreadDataClassH
#include "MultiThreadDataClass.h"
#endif

//---------------------------------------------------------------------------
class MultiFtpDownloadThread 
{            
private:
   bool FIsFileRead;
protected:
        void  Execute();
public:
	void SetSendWnd(CWnd *wnd);
	void InitThread();
         MultiFtpDownloadThread(bool CreateSuspended );
         ~MultiFtpDownloadThread();
        SOCKET   commandClient;
        SOCKET   dataClient;
        CString  localFileLoad;
        CString  FileName;
        int    ID;
        int    perFileLen;
        void*  parent;
	    HANDLE m_hThread;
        CWnd   *m_SendWnd;
        CString m_Error;

        void  DoOnComplete();
        void  DoOnTextOut(CString text);
        void  DoOnException(CString error);
        void  DoOnProgress(DWORD pos);
        bool  DownLoad(DWORD pos ,DWORD len);
        bool  CreateDataCon();
        bool  SetFilePos(DWORD pos);
		static ULONG WINAPI Global_Func(LPVOID lParam);
	    CString    IntToStr(DWORD len);
        int        StrToInt(CString str); 
        int   UnicodeSend(SOCKET client,CString command);
//         TOnComplete FOnComplete;
//         TOnTextOut FOnTextOut;
//         TOnException FOnException;
//         TOnProgress FOnProgress;
// __property bool IsFileRead={read=FIsFileRead,write=FIsFileRead};
// __property TOnComplete OnComplete={read = FOnComplete , write =FOnComplete};
// __property TOnTextOut OnTextOut={read = FOnTextOut,write= FOnTextOut};
// __property TOnException OnException = {read = FOnException ,write = FOnException};
// __property TOnProgress OnProgress= {read = FOnProgress ,write = FOnProgress};
};
//---------------------------------------------------------------------------
#endif
